//
//  LTFView.m
//  UI2_设计模式课堂练习下午
//
//  Created by dllo on 15/11/9.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "LTFView.h"

@interface LTFView () <UITextFieldDelegate>

@end

@implementation LTFView

- (void)dealloc
{
    [_label release];
    [_textF release];
    [super dealloc];
}

// 重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}


- (void)createSubviews
{
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width / 4.0, self.frame.size.height)];
//    self.label.backgroundColor = [UIColor redColor];
    [self addSubview:self.label];
    [_label release];
    
    self.textF = [[UITextField alloc] initWithFrame:CGRectMake(self.label.frame.size.width, 0, self.frame.size.width * 3 / 4.0, self.frame.size.height)];
    //设置一些共通的属性
    self.textF.delegate = self;
    self.textF.clearButtonMode = UITextFieldViewModeAlways;
    self.textF.borderStyle = UITextBorderStyleRoundedRect;
    [self addSubview:self.textF];
    [_textF release];
    
    
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}










@end
